<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>用户登录</title>
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
  <meta name="author" content="Vincent Garreau" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" media="screen" href="css/style.css">
  <link rel="stylesheet" type="text/css" href="css/reset.css"/>
	<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body>

<div id="particles-js">
		<div class="login">
			<div class="login-top" >
				欢迎登录
			</div>
			<form id="form" action="/suibian" method="post">
				<input type="hidden" name="_csrf" th:value="${_csrf.token}">
				<div class="login-center clearfix">
					<div class="login-center-img"><img src="img/name.png"/></div>
					<span th:if="${loginFail}=='T'" style="color:#ff0000">用户名或密码错误或账号已锁定</span>
					<label style="color: red" th:text="${msg}"></label>
					<div class="login-center-input">
						<input type="text" name="username" value="" placeholder="请输入您的帐号" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的帐号'"/>
						<div class="login-center-input-text">账号</div>
					</div>
				</div>
				<div class="login-center clearfix">
					<div class="login-center-img"><img src="img/password.png"/></div>
					<div class="login-center-input">
						<input type="password" name="password" value="" placeholder="请输入您的密码" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'"/>
						<div class="login-center-input-text">密码</div>
					</div>
				</div>
				<div class="login-button"
					 id="TencentCaptcha"
					 data-appid="2011491693"
					 data-cbfn="callback">
					登录
				</div>
				<br><br>
				<div align="center">
					<div class="login-center-img1" align="center"><img src="img/logo.png"/></div>
					<a href="https://cas.dgut.edu.cn?appid=javaee">中央认证登录</a>
				</div>
				<br><br>
				<div align="center">
				<a href="/register" >注册</a>
					</div>
			</form>
		</div>
		<div class="sk-rotating-plane"></div>
</div>



<script src="js/particles.min.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">
	function hasClass(elem, cls) {
	  cls = cls || '';
	  if (cls.replace(/\s/g, '').length == 0) return false;
	  return new RegExp(' ' + cls + ' ').test(' ' + elem.className + ' ');
	}

	window.callback = function(res){
		console.log(res)
		if(res.ret === 0){
			//alert(res.ticket)   // 票据
			jQuery.post({
				url : 'http://120.79.140.61/sert' ,
				data : {
					'ticket':res.ticket,
					"randstr":res.randstr,
				},
				success : function ( result ) {
					if (result){
						$("#form").submit();
					}else {
						alert("验证失败")
					}
					}
			})
		}
	}

</script>

</body>
</html>